#include <stdio.h>
int main()
{
    int i = 10000;

    for (i = 10000; i <= 99999; i++)
    {

        int n = 0;
        int sum = 0;
        int tmp = i;
        for (n = 10; n < 100000; n *= 10)
        {
            sum += (tmp % n) * (tmp / n);
        }
        if (sum == i)

            printf("%d ", i);
    }
    return 0;
}